package xGRUx.MCdirGlztab;


import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.webkit.WebSettings;
import android.webkit.WebView;

public class PlayAct extends Activity
{
	private WebView m_Viewer;
	
	final String ENCODING = "utf-8";
	
	@Override
	public void onResume() {
		super.onResume();
		
		writeContent(this.m_Viewer);
	}
	
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
	    setContentView(R.layout.view);
	    
	    
	    this.m_Viewer = (WebView)findViewById(R.id.webview);
	    WebSettings sett = this.m_Viewer.getSettings();
		sett.setJavaScriptEnabled(true);   
		sett.setSupportZoom(true);
		sett.setBuiltInZoomControls(true);
		sett.setDefaultFontSize(15);
		sett.setFixedFontFamily("file://"+getFilesDir().getAbsolutePath() +"/DroidSans-Regular.ttf");
		sett.setDefaultTextEncodingName(ENCODING);
		//sett.setLayoutAlgorithm(LayoutAlgorithm.SINGLE_COLUMN);
		
	    writeContent(this.m_Viewer);
	}

	private void writeContent(WebView v)
	{
		Intent i = getParent().getIntent();
		String content = i.getStringExtra("StoryContent");
		
		if(content !=null && content != "") {
			v.loadData(content,"text/html", ENCODING);
		}
		
	}
}
